import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooDbInfoController } from '../../../controllers';
const uctoodbInfoRouter = new Router();
const dbInfoController = new uctooDbInfoController();

uctoodbInfoRouter.post('/add', requireUser, dbInfoController.add);
uctoodbInfoRouter.post('/edit', requireUser, rowLevelPermission('uctoo/db_info'), dbInfoController.edit);
uctoodbInfoRouter.post('/del', requireUser, rowLevelPermission('uctoo/db_info'), dbInfoController.delete);

//For getting dbInfo with permission control
uctoodbInfoRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/db_info'), dbInfoController.getSingle);
uctoodbInfoRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/db_info'), dbInfoController.getMany);
uctoodbInfoRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/db_info'), dbInfoController.getMany);

//#endregion AutoCreateCode
export default uctoodbInfoRouter;
